<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html:html>
<head>
	<META http-equiv=Content-Type content="text/html; charset=utf-8">
	<LINK href="../styles/stylewang.css"  type=text/css rel=stylesheet>
	<LINK href="styles/stylewang.css"  type=text/css rel=stylesheet>
	<LINK href="xtree.css"  type=text/css rel=stylesheet>
	<style type="text/css">CG</style>
	<html:base/>
	
	<script language=javascript>
			function changeDes(){
				window.open("<%=request.getContextPath()%>/detail/edit2.jsp?op=des&shotId=<bean:write name='shot' 

property='shotId'/>",null,'top=150,left=150,scrollbars=yes,dialog=yes,modal=yes,width=600,height=445,resizable=no');
			}
			function changeDialog(){
				window.open("<%=request.getContextPath()%>/detail/edit2.jsp?op=dialog&shotId=<bean:write name='shot' 

property='shotId'/>",null,'top=150,left=150,scrollbars=yes,dialog=yes,modal=yes,width=600,height=445,resizable=no');
			}
			function changeNote(){
				window.open("<%=request.getContextPath()%>/detail/edit2.jsp?op=note&shotId=<bean:write name='shot' 

property='shotId'/>",null,'top=150,left=150,scrollbars=yes,dialog=yes,modal=yes,width=600,height=445,resizable=no');
			}

			//设定一个变量来表示当前显示的图片
			var currentSB=0;
			function showSB(name)
			{	
				var img=top.B.Child.document.getElementById("previewImg");
				img.src="dlf/"+"<bean:write name="SBPath"/>"+name;
				img.onclick=function(){window.open

(img.src,null,"top=150,left=150,scrollbars=yes,dialog=yes,modal=yes,width=520,height=620,resizable=yes");}
				showSBNumber();
			}
			function format(shotName ,fileName)
			{
				fileName = fileName.replace(shotName,"");
				fileName = fileName.replace(/_/g,"");
				return fileName;
			}
			function autoShowSB(){
				var buttons=window.document.getElementsByTagName("button");
				if(buttons.length!=0){
					var src=buttons[0].id;
					showSB(src);
				}
				showSBNumber();
			}
			function firstSB(){
				currentSB=0;
				autoShowSB();
			}
			function nextSB(){
				var buttons=document.getElementsByTagName("button");
				for(var i=0;i<buttons.length;i++){
					if(i==currentSB && i<buttons.length-1){
						buttons[i+1].click();
						return;
					}
				}
			}
			function previousSB(){
				var buttons=document.getElementsByTagName("button");
				for(var i=0;i<buttons.length;i++){
					if(i==currentSB && i>0){
						buttons[i-1].click();
					}
				}
			}
			function changeButtonId(but){
				var buttons=document.getElementsByTagName("button");
				for(var i=0;i<buttons.length;i++){
					if(buttons[i].id==but.id){
						currentSB=i;
						return;
					}
				}
			}
			function showSBNumber(){
				var buttonTd=document.getElementById("buttons");
				var buttons=document.getElementsByTagName("button");
				buttonTd.innerHTML=currentSB+1+"/"+buttons.length;
			}
	</script>
</head>
<body onLoad="autoShowSB();">
<table border="0"  width="100%" id="table1" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" class="onlybt">&nbsp;
    	<logic:notEmpty name="SBNames">
    	<logic:iterate name="SBNames" id="element">
			<button id="<bean:write name="element"/>" onClick="changeButtonId(this);showSB('<bean:write name="element"/>');">
					<script language=javascript>

					var s=format('<bean:write name="shot" property="shotName" />','<bean:write name="element" />');
					
					document.write(s.split(".")[0]);
					
					</script>
			</button>&nbsp;&nbsp; 
		</logic:iterate>
		<input type="button" value="|&lt;&nbsp;" onClick="firstSB();">
		<input type="button" value="&lt;&nbsp;" onClick="previousSB();">
		<input type="button" value="&gt;&nbsp;" onClick="nextSB()">&nbsp;&nbsp;
		<span id="buttons"></span>
		</logic:notEmpty>
	</td>
  </tr>
  <tr>
			<td  width="50%" id="btleftbian">&nbsp;<b><bean:message key="description"/>&nbsp;</b>
				<logic:notEmpty name="Manage">
				<input type='button' Value="<bean:message key='basicmodify'/>" onClick="changeDes()"/>
				</logic:notEmpty>
			</td>
			<td  width="50%" id="btrightbian">&nbsp;<b><bean:message key="dialog"/></b>
				<logic:notEmpty name="Manage">
				<input type='button' Value="<bean:message key='basicmodify'/>" onClick="changeDialog()"/>
				</logic:notEmpty>
			</td>
	</tr>
	<tr> 
			<td  width="50%" height="150" valign="top"  class="leftcenter" id="des">&nbsp;
	  <bean:write name="shot" property="shotDescription" filter="false"/></td>
			<td  width="50%" valign="top"  class="rightcenter" id="dialog"><bean:write name="shot" property="dialog" filter="false"/>&nbsp;</td>
			
	</tr>
	<tr>
	<td colspan="2" id="rightcenter">
		<b><bean:message key="remark"/></b><logic:notEmpty name="Manage">
				<input type='button' Value="<bean:message key='basicmodify'/>" onClick="changeNote()"/>
				</logic:notEmpty>
	</td>
	</tr>
	<tr>
	<td colspan="2" valign="top" class="rightbottom" id="note"><bean:write name="shot" property="note" filter="false"/>&nbsp;</td>
	</tr>
</table>


</body>
</html:html>
